﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Task>" %>
<%@ Import Namespace="ViewRes" %>

<script type="text/javascript">
    $(function() {
        $("#CollaborationRoomId").clone().appendTo("#taskEditForm");
    });
</script>
<div class="container">
    <%
        using (
            Html.BeginRouteForm("Default", new {controller = "Tasks", action = "Edit"}, FormMethod.Post,
                                new {id = "taskEditForm"}))
        {%>
    <%:Html.HiddenFor(s => s.CheckPointId)%>
    <span>
        <%:Html.DropDownList("PlaningTypeId", (IEnumerable<SelectListItem>) ViewData["PlaningTypes"],
                                                new {onchange = "planingTypeChanged()"})%>
    </span>
    <table>
        <tr>
            <td>
                <%:SharedStrings.Name%>
            </td>
            <td>
                <%:Html.TextBoxFor(gt => gt.Name)%>
            </td>
        </tr>
        <tr>
            <td>
                <%:SharedStrings.Description%>:
            </td>
            <td>
                <%:Html.TextBoxFor(gt => gt.Description)%>
            </td>
        </tr>
        <tr>
            <td>
                 <%:SharedStrings.Date%>
            </td>
            <td>
                <%:Html.TextBoxFor(model => model.StartDate, new {id = "StartDate"})%>
            </td>
        </tr>
        <tr>
            <td>
                <a href="javascript:void(0)" onclick=' loadTasksByRoomAndPlaning("PlaningTypeId", $("#StartDate").val(), "PrevCheckPointId"); '>
                    <%:LecturerStrings.Previous%></a>
            </td>
            <td>
                <select id="PrevCheckPointId" name="PrevCheckPointId" >
                    <%
            if (Model.PrevCheckPoint != null)
            {%>
                    <option class='disabled' value='<%:Model.PrevCheckPoint.CheckPointId%>'>
                        <%:Model.PrevCheckPoint.Name%></option>
                    <%
            }%>
                    <option class='disabled'><%:LecturerStrings.No%></option>
                </select>
            </td>
        </tr>
         <tr>
            <td>
               <%:LecturerStrings.Completed%>
            </td>
            <td>
            <%
            if ((Model.PrevCheckPoint != null) && (Model.PrevCheckPoint is Task) &&
                !(Model.PrevCheckPoint as Task).IsCompleted)
            {%>
                 <%:LecturerStrings.CopletePrevious%>
            <%
            } %>
            <%
            else
            {%>
                <%:Html.CheckBoxFor(model => model.IsCompleted)%>
             <%
            }%>
            </td>
        </tr>
    </table>
    <div style="float: right">
        <input type="submit" value="OK" />
    </div>
    <%
        }%>
</div>
